package com.qrxl.enums;

import com.qrxl.common.exception.CustomException;

/**
 * @author zhangyongchun
 */

public enum EnumUserType {

    SUPPER_ADMIN(1, "超级管理员"),
    ADMIN(2, "平台管理员"),
    USER(3, "普通用户"),
    ;
    private Integer code;
    private String name;

    EnumUserType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static EnumUserType getType(Integer code) {
        for (EnumUserType anEnum : EnumUserType.values()) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        throw new CustomException("性别不合法!");
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
